<?php
$section = 'newsletter';

$titre = _LB_NEWSLETTER_MANAGEMENT;
$smarty->assign("titre", $titre);

$out = "";

$newsletter = new Newsletter();
$newsletter->find();
while($newsletter->fetch()){
    $out .= $newsletter->EMAIL."\n";
}

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Length: " . strlen($out));
// Output to browser with appropriate mime type, you choose <img src="http://thetechnofreak.com/wp-includes/images/smilies/icon_wink.gif" alt=";)" class="wp-smiley">
header("Content-type: text/x-csv");
//header("Content-type: text/csv");
//header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=listNewsletterEmail.csv");
echo $out;
exit;